recentpopularlog in

kme : epiphany   14

python - How does the dependency resolution works with pip when a package specify a range and another doesn't? - Stack Overflow
I think I just understood "global dependency" resolution. IPython and ptpython require prompt_toolkit >= 2.something, but 'mycli' depends on something like 0.16. So installing 'mycli' with pip will always break IPython, and vice-versa.
python  dependencies  pip  dependencyhell  dependencyresolution  epiphany 
august 2019 by kme
linux - Why redirect stdin inside a while read loop in bash? - Stack Overflow | https://stackoverflow.com/
The clear intent here is to prevent do_something from reading from the sample.text stream, by ensuring that its stdin is coming from elsewhere. If you're not seeing differences in behavior with or without the redirection, that's because do_something isn't actually reading from stdin in your tests.

[...]

By the way, I would write this more as follows:
<code class="language-bash">exec 3</dev/tty || exec 3<&0 ## make FD 3 point to the TTY or stdin (as fallback)

while read -a args; do ## |- loop over lines read from FD 0
do_something "${args[@]}" <&3 ## |- run do_something with its stdin copied from FD 3
done <sample.text ## \-> ...while the loop is run with sample.txt on FD 0

exec 3<&- ## close FD 3 when done.</code>

It's a little more verbose, needing to explicitly close FD 3, but it means that our code is no longer broken if we're run with stdout attached to the write-only side of a FIFO (or any other write-only interface) rather than directly to a TTY.
bash  shellscripting  stdin  filedescriptors  epiphany  tipsandtricks  solution 
march 2019 by kme
Bash Scripting – Best Practices « andreINC
trap "clean_up" EXIT SIGQUIT SIGKILL SIGTERM


"Why didn't Andre trap SIGINT?" I wondered. Because EXIT still happens after a SIGINT. If you trap SIGINT (and don't 'exit' in your handler), you lose the ability to kill a script that's in an infinite loop, e.g.:
#!/usr/bin/env bash

TEMP=`mktemp test-XXXXXX`
trap "rm -f '$TEMP'" EXIT

while true; do
echo -n '.'
sleep 3
done
bash  shellscripting  epiphany  security  sysadmin  bestpractices  reference 
june 2015 by kme
gcc - CFLAGS, CCFLAGS, CXXFLAGS - what exactly do these variables control? - Stack Overflow
Epiphany: there is nothing special about these variables and GCC/G++ does not explicitly look for the definitions of these variables in the environment (they don't seem to be referred to in the info page for GCC anywhere). They're merely a Makefile convention, and the variables need to be included on the gcc/g++ command line within the Makefile. Hence the discrepancy between "CPPFLAGS" seen in some places and "CPPFLAGS" seen in others.

However, having them defined in the environment is *still* useful, because then you can just refer to them within Makefiles, with the expectation that the definition come from the users' environment.

It took me over a decade to come to this realization, finally, in March 2015.
epiphany  devel  gcc  compiler  cflags  environmentvariables 
march 2015 by kme
I like Unicorn (Rack HTTP server) because it's Unix | Hacker News
A good, old-fashioned fork(2) resets the address space to a known-ok state; after the client connection is done with, whatever fragmentation the request has introduced disappears with its container process. The canonical, ancient structure of UNIX servers (fork after accept) was what enabled those servers to stay up for months and years at a time, but very few people made that connection. When processes were the only concurrency primitive available, we saw only their costs, and assumed threads would be better, since their costs were lower. In some ways, processes were the devil we knew, and threads an unfamiliar devil; in addition to all the usual complaints (e.g., about how hard it is to synchronize), threads mean that the global heap lives forever.
multithreading  fork  unix  networking  unp  reliability  epiphany 
october 2014 by kme
Git For Ages 4 And Up | Open Source Developers' Conference 2010 [http://2010.osdc.com.au/]
Michael Schwern

Schwern has a copy of Perl 6, he lets Larry Wall borrow it and take notes.

Schwern once sneezed into a microphone and the text-to-speech conversion was a regex that turns crap into gold.

Damian Conway and Schwern once had an arm wrestling contest. The superposition still hasn't collapsed.

Schwern was the keynote speaker at the first YAPC::Mars.

When Schwern runs a smoke test, the fire department is notified.

Dan Brown analyzed a JAPH Schwern wrote and discovered it contained the Bible.

Schwern writes Perl code that writes Makefiles that write shell scripts on VMS.

Schwern does not commit to master, master commits to Schwern.

SETI broadcast some of Schwern's Perl code into space. 8 years later they got a reply thanking them for the improved hyper drive plans.

Schwern once accidentally typed "git pull --hard" and dragged Github's server room 10 miles.

There are no free namespaces on CPAN, there are just modules Schwern has not written yet.

Schwern's tears are said to cure cancer, unfortunately his Perl code gives it right back.
video  git  epiphany  conference  newbie  versioncontrol  explained 
october 2014 by kme
GNU make: Phony Targets
So *that's* what that's for:
In this example, the clean target will not work properly if a file named clean is ever created in this directory. Since it has no prerequisites, clean would always be considered up to date and its recipe would not be executed. To avoid this problem you can explicitly declare the target to be phony by making it a prerequisite of the special target .PHONY (see Special Built-in Target Names) as follows:

.PHONY: clean
clean:
rm *.o temp
make  build  toolchain  devel  epiphany 
october 2014 by kme
Jessica Kerr "Git Happens" - YouTube
So, 'git rebase -i' allows you to "pick" some commits to have their own commit in the origin's history (possibly out of order) and choose to "squash" other commits (like when I do 'checkpoint' commits, or Jessica's example of 'Going to lunch') so that they don't clutter up the origin repository's history.
git  gitrebase  conference  talk  video  whenthingsgowrong  explained  epiphany 
september 2014 by kme
javascript - jQuery $(this) vs this - Stack Overflow [http://stackoverflow.com/]
Yes you only need $() when you're using jQuery. If you want jQuery's help to do DOM things just keep this in mind.

$(this)[0] === this
Basically every time you get a set of elements back jQuery turns it into an array. If you know you only have one result, it's going to be in the first element.

$("#myDiv")[0] === document.getElementById("myDiv");
jquery  epiphany  webdevel  programming  selectors  this  javascript 
july 2014 by kme
hoelz.ro - Makefile Tips and Tricks [http://hoelz.ro/]
Make evaluates each line in a different shell, so this won't work:

bundle:
tmpdir=`mktemp -d -t bundle` # using `` instead of $() to avoid more escaping
make install INSTALL_DIR="$$tmpdir"
...
You have to tell Makefile to treat them as a single line with a backslash, and tell the shell each is a separate statement with a semicolon:

bundle:
tmpdir=`mktemp -d -t bundle` ; \
make install INSTALL_DIR="$$tmpdir" ; \
...
make  toolchain  builtdtools  reference  dammitbrain  quickref  tipsandtricks  oneliners  epiphany  solution 
february 2014 by kme
Code Refactoring - YouTube
Totally intelligible explanation of why creation methods are used when multiple constructors won't work because: 1) you'll end up with multiple constructors with the same signature, or 2) your constructor isn't descriptive enough (has to match the class name, remember?) to tell them apart
creationmethod  designpattern  video  programming  java  epiphany  refactoring 
december 2013 by kme
7.6 Class definitions
Programmer's note: variables defined in the class definition are class variables; they are shared by all instances. To define instance variables, they must be given a value in the the __init__() method or in another method. Both class and instance variables are accessible through the notation ``self.name'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables.
python  epiphany  programming  dammitbrain  oop 
march 2013 by kme

Copy this bookmark:





to read