Skip to content

Instantly share code, notes, and snippets.

View htfy96's full-sized avatar
🐢
WFH

Zheng Luo htfy96

🐢
WFH
View GitHub Profile
@teqdruid
teqdruid / perf_event_template.c
Created April 23, 2012 18:59
Template for using perf_event
/*
============================================================================
Name : branch_mispred.c
Author : John Demme
Version : Mar 21, 2011
Description : A template for perf_event. Requires Linux 2.6.32 or higher
============================================================================
*/
#define _GNU_SOURCE
@amaxwell01
amaxwell01 / interviewitems.MD
Created September 15, 2012 14:17
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@skyscribe
skyscribe / .gdbinit
Created October 30, 2012 03:04
GDB init file to print STL containers and data members
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@raskasa
raskasa / utility-functions.prolog
Created December 14, 2012 03:23
All useful Prolog functions learned over the course of the semester in CS 341 - Programming Languages.
% Contained within are all the useful Prolog functions learned in CS 341 this past semester (Fall 2012).
% NOTE: Any functions used that are not defined in this file are built-in functions.
% length(+As,-N)
% returns in N the length of the list As
length([],0).
length([A|As],N) :- length(As,M), N is M+1.
% append(+As,+Bs,-Cs)
% returns in Cs the append of lists As and Bs
@jareware
jareware / SCSS.md
Last active April 23, 2024 22:13
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@mgedmin
mgedmin / strace_process_tree.py
Last active January 13, 2021 15:02
Tool to help me make sense out of `strace -f` output.
in/python
# -*- coding: UTF-8 -*-
"""
Usage:
strace-process-tree filename
Read strace -f output and produce a process tree.
Recommended strace options for best results:
@chmouel
chmouel / git-branch-cleanup.sh
Last active September 14, 2022 15:56
Delete merged gerrit git branch using Change-ID
#!/bin/zsh
declare -a unmerged
git rev-parse --show-toplevel 2>/dev/null >/dev/null || { echo "Not a git dir"; exit 1 ;}
git fetch origin;
git branch --merged|grep -v 'master'|xargs git branch -d
for branch in $( git branch --no-merged );do
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@obihann
obihann / .nethackrc
Last active November 21, 2020 17:03
NetHack Config
OPTIONS=showexp,showscore,time,color,!autopickup,pickup_burden:unencumbered
OPTIONS=pickup_types:$?!/(+
OPTIONS=autodig,fruit:slime mold,boulder:0
OPTIONS=number_pad:2
OPTIONS=suppress_alert:3.4.3
MSGTYPE=hide "You displaced *." # pet displacement
OPTIONS=statuscolors
STATUSCOLOR=hp%100=green,hp%66=yellow,hp%50=orange