Skip to content

Instantly share code, notes, and snippets.

View alienzj's full-sized avatar
🦀
MAGs lives matter

Jie Zhu alienzj

🦀
MAGs lives matter
View GitHub Profile
@netj
netj / memusg
Last active May 17, 2024 21:28
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@jinwei233
jinwei233 / python_brownser.py
Created October 3, 2011 16:39
用python 模拟浏览器行为
import sys, time, os
from mechanize import Browser
LOGIN_URL = 'http://www.example.com/login'
USERNAME = 'DavidMertz'
PASSWORD = 'TheSpanishInquisition'
SEARCH_URL = 'http://www.example.com/search?'
FIXED_QUERY = 'food=spam&' 'utensil=spork&' 'date=the_future&'
VARIABLE_QUERY = ['actor=%s' % actor for actor in
('Graham Chapman',
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 23, 2024 18:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@liekkas
liekkas / del_dir.py
Created July 10, 2012 09:36
python:删除指定的文件夹
# coding=utf-8
# 功能:删除某个文件夹下面所有的cvs文件夹
import os,shutil
# 删除某个项目里面所有为CVS的文件夹
def del_dirs(path):
for parent,dirnames,filenames in os.walk(path):
for dirname in dirnames:
if dirname == 'CVS':
p = os.path.join(parent,dirname)
@P4
P4 / default.reg
Last active April 13, 2024 05:23
Color schemes for Windows Command Prompt
Windows Registry Editor Version 5.00
; Default color scheme
; for Windows command prompt.
; Values stored as 00-BB-GG-RR
[HKEY_CURRENT_USER\Console]
; BLACK DGRAY
"ColorTable00"=dword:00000000
"ColorTable08"=dword:00808080
; BLUE LBLUE
@mislav
mislav / _readme.md
Last active May 15, 2024 11:03
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@microcai
microcai / base64.hpp
Last active March 31, 2020 16:24
base64.hpp
#pragma once
#include <string>
#include <boost/archive/iterators/binary_from_base64.hpp>
#include <boost/archive/iterators/transform_width.hpp>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/algorithm/string.hpp>
@josecarlosgonz
josecarlosgonz / GoogleMapsAndR.md
Last active July 22, 2022 07:56
How to use Google's API with R

Using Google Maps API and R

This script uses RCurl and RJSONIO to download data from Google's API to get the latitude, longitude, location type, and formatted address

library(RCurl)
library(RJSONIO)
library(plyr)
@ChrisBeeley
ChrisBeeley / server.R
Last active October 2, 2019 15:55
Demo to show widget types, return values and data types in Shiny
function(input, output) {
output$textDisplay <- renderTable({
getMat = matrix(
c(paste(input$checkGroup, collapse=','), class(input$checkGroup),
input$boxInput, class(input$boxInput),
as.character(as.Date(input$theDate, origin = "1970-01-01")), class(input$theDate),
paste(as.character(as.Date(input$dateRange[[1]], origin = "1970-01-01")),
as.character(as.Date(input$dateRange[[2]], origin = "1970-01-01")),