Skip to content

Instantly share code, notes, and snippets.

View hayeah's full-sized avatar
🕳️
Focusing

blah blah hayeah

🕳️
Focusing
View GitHub Profile
@hayeah
hayeah / gist:5552987
Created May 10, 2013 07:41
linked list
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
typedef struct node{
int e;
struct node *next;
} node;
node *list_build(int* a,int size) {
@hayeah
hayeah / gist:5821472
Last active December 18, 2015 17:49
link images downloaded by exporter into img2
# files = `find /pf/puffant/images/member_photos/ -links 1`.split "n" ; 3
files = Dir["/pf/puffant/images/member_photos/**/*_o.*"]
files.each_slice(1000) do |ff|
link_files(ff)
end
def img_ids(files)
ids = files.map { |file|
name = File.basename(file)
img_id = name.split("_")[0].to_i
@hayeah
hayeah / gist:5914730
Created July 3, 2013 01:20
coupon apply error
A NameError occurred in orders#apply_pf_coupon:
uninitialized constant Puffant::Coupon::InvalidCode
app/controllers/puffant/orders_controller.rb:53:in `rescue in apply_pf_coupon'
-------------------------------
Request:
-------------------------------
@hayeah
hayeah / gist:5984309
Created July 12, 2013 13:05
slim jboss deploy
NAMES=$(cat <<HERE
management
hdscanner-jboss-beans.xml
jbossws-console.war
mail-service.xml
mail-ra.rar
http-invoker.sar
admin-console.war
jmx-remoting.sar
jmx-console.war
-epoch--- ----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
1375497479| 3 2 49 47 0 0| 16k 24k| 109B 227B| 0 0 | 219 538
1375497480| 3 2 50 46 0 0| 0 2144k| 321B 684B| 0 0 | 272 606
1375497481| 2 0 49 49 0 0| 0 1156k| 110B 98B| 0 0 | 361 827
1375497482| 2 2 49 46 0 0| 0 576k| 224B 617B| 0 0 | 366 752
1375497483| 6 6 44 45 0 0| 0 0 | 23k 449B| 0 0 | 466 797
1375497484| 1 0 50 49 0 0| 0 1548k| 166B 305B| 0 0 | 235 611
1375497485| 1 3 47 49 0 0| 0 1208k| 121B 220B| 0 0 | 296 787
1375497486| 1 0 50 50 0 0| 0 4096B| 117B 225B| 0 0 | 282 602
1375497487| 3 2 46 49 0 0| 0 640k| 119B 221B| 0 0 | 264 591
@hayeah
hayeah / gist:6170397
Created August 7, 2013 01:14
docker test error
2013/08/07 01:11:38 Listening for HTTP on 127.0.0.1:4270 (tcp)
2013/08/07 01:11:46 Container ca3c6649560249e1afb6ab511d28894a4f8f4d3da60cb64b5f378f93e83c2959 failed to exit within 1 seconds of SIGTERM - using the force
2013/08/07 01:11:49 lxc-kill: 'f7624a41c5e0188aa7f0873fb47ae53cfb0df37693fc599a07e145457f6536b5' is not running
lxc-kill: failed to get the init pid
2013/08/07 01:11:49 Failed to send SIGTERM to the process, force killing
2013/08/07 01:11:49 error killing container f7624a41c5e0188aa7f0873fb47ae53cfb0df37693fc599a07e145457f6536b5 (lxc-kill: 'f7624a41c5e0188aa7f0873fb47ae53cfb0df37693fc599a07e145457f6536b5' is not running
lxc-kill: failed to get the init pid
, exit status 255)
2013/08/07 01:11:59 Container f7624a41c5e0188aa7f0873fb47ae53cfb0df37693fc599a07e145457f6536b5 failed to exit within 10 seconds of lxc SIGKILL - trying direct SIGKILL
2013/08/07 01:12:15 error killing container 7afc506d484b7ae8455f523209395e2a6523c9cc52567f3de8416f6028149f84 (lxc-kill: '7afc506d484b7ae8455f523209395e2a6523c
deb http://archive.ubuntu.com/ubuntu precise main
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb http://us.archive.ubuntu.com/ubuntu/ precise universe
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
@hayeah
hayeah / -
Created November 20, 2013 08:42
ceremony to indent output
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- greeting.xsl --> <!-- greeting.xsl -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/19
<xsl:output method="html"/> | xmlns:redirect="http://xml.apache.org/xalan/redirect"
> extension-element-prefixes="redirect"
> xmlns:xalan="http://xml.apache.org/xslt"
> >
> <xsl:output method="html" indent="yes" xalan:indent-amount=
<xsl:template match="/"> <xsl:template match="/">
@hayeah
hayeah / gist:7638866
Created November 25, 2013 09:36
80 chars
00000000000000000000000000000000000000000000000000000000000000000000000000000000
11111111111111111111111111111111111111111111111111111111111111111111111111111111
22222222222222222222222222222222222222222222222222222222222222222222222222222222
33333333333333333333333333333333333333333333333333333333333333333333333333333333
44444444444444444444444444444444444444444444444444444444444444444444444444444444
55555555555555555555555555555555555555555555555555555555555555555555555555555555
66666666666666666666666666666666666666666666666666666666666666666666666666666666
77777777777777777777777777777777777777777777777777777777777777777777777777777777
88888888888888888888888888888888888888888888888888888888888888888888888888888888
99999999999999999999999999999999999999999999999999999999999999999999999999999999
@hayeah
hayeah / -
Created November 27, 2013 14:19
What a template might look like
# Creating and Using Regexps
You're reading this because you want to use regular expressions when you code.
So this is probably a good time to tell you how to represent and use regular
expressions in your programs.
The good news is that most languages make it easy to use regular expressions.
The bad news is that each language does it differently.
{{#margin id="babel-tower"}}
{{img "images/iStock_000005187601Large-babel.png"}}