Skip to content

Instantly share code, notes, and snippets.

@7c00
7c00 / password-to-csv.awk
Created April 17, 2015 09:05
ChromePass password to csv
#!/usr/bin/awk -f
BEGIN {
FS=":"
OFS=","
arr["a"]=""
print "url,username,password,name"
}
function trim(s) { gsub(/ /, "", s); return s }
@7c00
7c00 / README.md
Created November 24, 2015 08:34 — forked from evandrix/README.md
Headless web browsers

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
import itertools
def parse_ip(ip):
rans = map(lambda x: range(x[0], x[-1] + 1),
[map(int, part.split('-')) for part in ip.split('.')])
return ['.'.join(map(str, i)) for i in itertools.product(*rans)]
if __name__ == '__main__':
print('\n'.join(parse_ip('192.168.1-2.1-10')))
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : ""
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
function! s:skinny_insert(char)
if !pumvisible() && !exists('s:skinny_complete') &&
\ getline('.')[col('.') - 2].a:char =~# '\k\k'
@7c00
7c00 / minimal-autocomplete.vim
Created January 22, 2016 04:27 — forked from qstrahl/minimal-autocomplete.vim
Super lightweight autocomplete using vim's built-in <C-n> completion
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
ino <CR> <C-r>=pumvisible()?"\<lt>C-y>":""<CR><CR>
ino <Tab> <C-r>=pumvisible()?"\<lt>C-n>":"\<lt>Tab>"<CR>
ino <S-Tab> <C-r>=pumvisible()?"\<lt>C-p>":"\<lt>S-Tab>"<CR>
augroup MyAutoComplete
au!
au InsertCharPre * if
@7c00
7c00 / gist:dcd0b132634bdd56a2f5141571d8621c
Created July 27, 2016 08:42 — forked from cridenour/gist:74e7635275331d5afa6b
Setting up Vim as your Go IDE

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.

#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
package main
import (
"fmt"
"os"
"reflect"
)
func main() {
if len(os.Args) >= 2 && os.Args[1] == "-p" {
@7c00
7c00 / ftp_upload.py
Created February 1, 2019 12:30
You don't need an FTP client. Python provides one!
#!/usr/bin/env python
# encoding: utf-8
import ftplib
import sys
ftp_server = sys.argv[1]
ftp_port = sys.argv[2]
filename = sys.argv[3]
@7c00
7c00 / trend.py
Created August 5, 2019 02:39
Send GitHub Trending via WeChat Work robots. 通过企业微信机器人发送 GitHub Trending.
#!/usr/bin/env python
# coding: utf-8
"""trend.py"""
import logging
import os
import requests
_SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))