This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process | |
def method_to_call(*args, **kwargs): | |
# do what you do | |
pass | |
def main(): | |
# | |
rows = ("job1", "job2") | |
procs = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find a user | |
(&(objectCategory=person)(objectClass=user)) | |
# recursive group membership using LDAP_MATCHING_RULE_IN_CHAIN | |
(&(objectCategory=person)(objectClass=user))(memberOf:1.2.840.113556.1.4.1941:=<groupdn>)) | |
# find all computer objects that are not disabled | |
(&(objectCategory=computer)(!(userAccountControl:1.2.840.113556.1.4.803:=2))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"io" | |
"os" | |
) | |
func cp(dst, src string) error { | |
s, err := os.Open(src) | |
if err != nil { | |
return err | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"encoding/binary" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
) | |
func download() string { | |
client := &http.Client{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
_ "expvar" | |
"fmt" | |
"net/http" | |
"os" | |
) | |
// use expvarmon to monitor: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"os/exec" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "sync" | |
var ( | |
r *repository | |
once sync.Once | |
) | |
func Repository() *repository { | |
if r == nil { | |
once.Do(func() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"time" | |
) | |
// Some APIs are designed with context interface, google search is an example. Use context to send cancel signal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use FindBin; | |
use DateTime; | |
use DateTime::Duration; | |
use Getopt::Long; | |
my ($days, $date); | |
GetOptions( |