Skip to content

Instantly share code, notes, and snippets.

@pavgup
pavgup / agent.cmd
Created October 24, 2015 01:53 — forked from Shoozza/agent.cmd
Make Cmder work with ssh-agent
@ECHO OFF
REM Set default sock file
SET SSH_AUTH_SOCK=/tmp/ssh-agent.sock
REM Check socket is available
IF NOT EXIST "%TMP%\ssh-agent.sock" GOTO:RUNAGENT
REM Check if an ssh-agent is running
FOR /f "tokens=*" %%I IN ('ps ^| grep ssh-agent ^| sed "s/^ *\([0-9]\+\) .*/\1/"') DO SET VAR=%%I
@pavgup
pavgup / 0-gists-are-sorted-alphabetically-hackityhack.md
Last active December 14, 2015 01:19
GCC 4.8 Compiles on OS X 10.11.1 with XCode 7.1 (7B91b); Availability.h has a couple obvious bugs (sigh.) BUT FIXED!

README FIRST; or. tl;dr: copy the file below to /usr/local/include and rebrew.

October 24, 2015: Being slightly bitter about Apple oversights into their seemingly thoughtful approaches and finding zero solutions in my fully updated OS X 10.1 (El Capitan!) macbook, I stopped waiting. This problem was easy enough; small oversight and lines 228 and 250 are modified to keep things moving on OS X. To be fair these fixes may also apply to the blocks for tvOS, watchos, ios, etc. The solution to this kind of stuff is to simply test these headers before pushing them out to the public.

@pavgup
pavgup / gist:9507202f4aa133901d1f
Last active December 21, 2015 15:55
count files recursively in directories and sort results
find . -maxdepth 3 -noleaf -type d -exec sh -c "ls -ltaR \"{}\" | wc -l | tr \"\n\" \" \" && echo \"{}\"" \; | sort -n
# or more simply without a sort:
find . -type d -maxdepth 1 -print0 -exec sh -c 'find "{}" -type f | wc -l' \;
2015-10-30 21:13:04 -0400
cmake
..
-DCMAKE_C_FLAGS_RELEASE=
-DCMAKE_CXX_FLAGS_RELEASE=
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv3/HEAD
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
@pavgup
pavgup / ansible_conditionals_examples.yaml
Created November 24, 2015 06:50 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
@pavgup
pavgup / mysql.yml
Created November 24, 2015 07:28
Surprisingly annoying use of conditionals and variables with ec2 instances and volumes. The ec2 module can comfortably create volumes that have controlled delete_on_termination flags but you must first provision the instance and the volume before you are able to tag the volume. Assuming you wanted to tag a single volume based on its device_name …
---
data_volume:
- name: mysql-data-drive
device_name: /dev/sdb
device_type: gp2
volume_size: 500
delete_on_termination: false
@pavgup
pavgup / grant.sql
Last active November 25, 2015 16:29
granting everything to root on mariadb over a private subnet
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.31.%.%' IDENTIFIED BY 'APASSWORDTHATISNOTREAL' WITH GRANT OPTION;
UPDATE mysql.user SET password=PASSWORD('realpasswordzl33t') WHERE User="root";
@pavgup
pavgup / gist:ad730f1191323b4d67d9473068e9ea10
Created August 12, 2016 02:23
Download JDK 8 update 102 at the command line
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.tar.gz
@pavgup
pavgup / commands.sh
Last active October 21, 2023 20:29
Install Python 2.7.13 on Debian Wheezy
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
sudo tar -xzf Python-2.7.13.tgz -C /usr/src
cd /usr/src/Python-2.7.3
sudo ./configure
sudo make
sudo make altinstall
@pavgup
pavgup / airflow sql deletes
Created July 18, 2017 19:59
getting rid of airflow dags, eek
Deleting DAGs in Airflow? Well, womp.
set @dag_id = 'etl_dag';
delete from airflow.xcom where dag_id = @dag_id;
delete from airflow.task_instance where dag_id = @dag_id;
delete from airflow.sla_miss where dag_id = @dag_id;
delete from airflow.log where dag_id = @dag_id;
delete from airflow.job where dag_id = @dag_id;
delete from airflow.dag_run where dag_id = @dag_id;
delete from airflow.dag where dag_id = @dag_id;