Skip to content

Instantly share code, notes, and snippets.

View realdubb's full-sized avatar
👋
200

Alex Wachira realdubb

👋
200
View GitHub Profile
@realdubb
realdubb / cloudinary.html
Created February 21, 2016 01:52
Gist to make an ajax/xhr request to cloudinary
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
@realdubb
realdubb / find_users_not_in_value_list.sql
Created November 11, 2016 17:40
Given a list of username as values - select the ones that don't exists in a user_table - tested in mariadb - should work in mysql
# Reference http://stackoverflow.com/a/10304316/3826642
#
# Given list of users 'bobby.flay' and 'con.artist', I want to find which of these don't exist in my Table user_table in column user_name
# 'user_namex' - can be anything you want
# a derived table name in FROM subselect is required
Select * from (
SELECT 'bobby.flay' user_namex UNION
SELECT 'con.artist'
) derived_table_name_required
@realdubb
realdubb / copy_ssh.sh
Created November 11, 2016 20:21
Add Public SSH Key to Remote Server in a Single Command
# Source: http://www.howtogeek.com/168147/add-public-ssh-key-to-remote-server-in-a-single-command/
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
@realdubb
realdubb / paths.txt
Last active November 11, 2016 20:29
Windows Paths Shortcuts
# Reference: http://ss64.com/nt/syntax-variables.html
# Startup Scripts Path
# This path is not available in Win 10
Currently using this on Win7
C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
# Available to both Win7/10
%PROGRAMDATA%\Microsoft\Windows\Start Menu\Programs\StartUp
@realdubb
realdubb / whatthefork
Last active November 12, 2016 20:29 — forked from Hellowlol/whatthefork
Check all forked branches if they are ahead of master/self open in browser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dirty script to check if any forks in ahead of master and open that branch commitlist
Warning: Uses alot of api calls
"""
import requests
from requests.auth import HTTPBasicAuth
@realdubb
realdubb / 404-check.sh
Created November 18, 2016 02:10 — forked from lkptrzk/404-check.sh
Script to test for 404s
#!/bin/sh
# 404-check.sh - Script to test for 404s
# author: lkptrzk
# Usage:
# Assuming a file named 'input' with one URL per line
# the following command will output which files were 404s:
# cat input | xargs 404-check.sh
@realdubb
realdubb / ubuntu_command.sh
Created December 23, 2016 21:32
A collection of commands to use
# Checking for logs in /var/log
# Clean up space
# source http://www.omgubuntu.co.uk/2016/08/5-ways-free-up-space-on-ubuntu
sudo apt-get autoremove --purge
# Check space
df -h
@realdubb
realdubb / whatsapp2slack.py
Created May 23, 2017 23:01 — forked from onekiloparsec/whatsapp2slack.py
Quick import-export script to move WhatsApp discussion threads to Slack.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import datetime
def main():
console_prefix = "$ "
@realdubb
realdubb / git-tips.md
Last active March 11, 2022 15:29
Often googled git questions.

How do I show the changes which have been staged?

git diff --cached

How do I force “git pull” to overwrite local files?

git fetch --all git reset --hard origin/<branch_name>

How do I pull changes to local branch that has been force pushed on remote?

git fetch

Keybase proof

I hereby claim:

  • I am realdubb on github.
  • I am wachira (https://keybase.io/wachira) on keybase.
  • I have a public key whose fingerprint is 9902 4557 F123 B82E B248 EF0E E603 57A1 7271 5DCB

To claim this, I am signing this object: