Linux or MacOS:
export SERVER = 'localhost'
Windows (PowerShell)
$Server = (Get-NetIPAddress -InterfaceAlias *docker* -AddressFamily IPv4).IPAddress
// clang -o program program.c $(sdl2-config --cflags --libs) && ls -lah && ./program | |
#include <SDL2/SDL.h> | |
#include <stdlib.h> | |
#include <time.h> | |
const int SCREEN_WIDTH = 640; | |
const int SCREEN_HEIGHT = 480; | |
const int LIGHT_TYPE_POINT = 1; |
package main | |
import ( | |
"context" | |
"io/ioutil" | |
"log" | |
"net" | |
"net/http" | |
"time" | |
) |
package main | |
import "fmt" | |
func main() { | |
var funcs1 []func() | |
var funcs2 []func() | |
for _, v := range []string{"create", "update", "delete"} { | |
fmt.Println(v, &v) |
! do not scroll with output | |
URxvt*scrollTtyOutput: false | |
! scroll in relation to buffer (with mouse scroll or Shift+Page Up) | |
URxvt*scrollWithBuffer: true | |
! scroll back to the bottom on keypress | |
URxvt*scrollTtyKeypress: true | |
#!/bin/sh | |
# utils / helpers | |
CSRF() { | |
printf '%s' "$(tr -dc '0-9a-z' </dev/urandom | head -c3)" | |
} | |
RANDOM_EMAIL() { | |
printf '%d%[email protected]' "$(date +%s)" "$(tr -dc '[:lower:]' </dev/urandom | head -c8)" |
import ( | |
"strings" | |
"bytes" | |
"strconv" | |
"context" | |
"encoding/json" | |
api "github.com/micro/go-api/proto" | |
) | |
type GraphqlOperation struct { |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
// global constants | |
#define PORT 8080 // port to connect on |
#!/bin/sh | |
pmap -x $(ps -fC "$1" | head -n2 | tail -n1 | awk '{print $2}') | tail -n 1 | awk '{print $3/1024 "MB"}' | |
# example usage: | |
# | |
# $ psmem chrome | |
# 1144.3MB |
Linux or MacOS:
export SERVER = 'localhost'
Windows (PowerShell)
$Server = (Get-NetIPAddress -InterfaceAlias *docker* -AddressFamily IPv4).IPAddress
<?php | |
$path = '/a/b/c/abc.jpg'; | |
$path_new = substr( $path, 0, strrpos( $path, '.' ) ) . '-thumb' . substr( $path, strrpos( $path, '.' ) ); | |
var_export( $path_new ); | |
// Output: /a/b/c/abc-thumb.jpg |