Skip to content

Instantly share code, notes, and snippets.

View gipsh's full-sized avatar
💭
Loading......

gipsh gipsh

💭
Loading......
View GitHub Profile
@gipsh
gipsh / gist:7eef87a52f6f99447e5b4c21b616bac6
Created October 22, 2021 13:04
curl upload s3 bucket pre-signed url with metadata
curl -v -X PUT -H "x-amz-meta-uploader:blabla" -T {file.png} -L "{pre-signed-url}"
@gipsh
gipsh / ubuntu_on_asus_TUF_A15_FA506IV.MD
Last active March 15, 2023 10:28
Ubuntu 20.04 on ASUS TUF A15 (FA506IV)

Installed using lived cd

Needed to add the nomodeset option to grub to correctly boot

After boot edit /etc/default/grub and add the nomodeset to the line with GRUB_CMDLINE_LINUX_DEFAULT.

Run this to make it persistent:

@gipsh
gipsh / set-aws-env.sh
Created August 4, 2020 14:49
set aws credentials into environment
PROFILES=$(awk -F"\\\]|\\\[" '/^\[/{print $2}' ~/.aws/credentials)
select PROFILE in $PROFILES; do
export AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id --profile $PROFILE)"
export AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key --profile $PROFILE)"
export AWS_DEFAULT_REGION="$(aws configure get region --profile $PROFILE)"
break
done
echo AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
@gipsh
gipsh / threadpool-test.rb
Created July 25, 2019 19:07
concurrency thread pool
require 'concurrent-ruby'
$pool = Concurrent::FixedThreadPool.new(2)
$pool.post do
{your function or block}
end
@gipsh
gipsh / Hik-motion.MD
Last active November 5, 2022 13:55
Hikvision GET and SET motion detection

GET MD settings

curl -u admin:xxxxxxx http://192.168.0.10/ISAPI/System/Video/inputs/channels/2/MotionDetection
@gipsh
gipsh / hi3518bootfromsd.MD
Last active September 21, 2020 20:03
hi3518 boot uimage from sd with uboot
  1. ctrl-u to enter bootloader

  2. check you SD partition: fatinfo mmc 0:1

  3. load the kernel image into memory: fatload mmc 0:1 0x82000000 uimage

  4. boot the image: bootm 0x82000000

@gipsh
gipsh / gist:7c825f8039515a2351559eb9fd5de8d5
Created July 10, 2018 16:01
install ida on ubuntu 17.10 and probably others
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1
sudo apt-get install libfontconfig1:i386 libxrender1:i386 libsm6:i386 libfreetype6:i386 libglib2.0-0:i386
sudo apt-get install libxext6:i386
@gipsh
gipsh / ftp_uplodaer_threaded.rb
Created May 24, 2018 22:18
ftp upload file benchmark test with threads
FTP_HOST = "ftp.pepe.com"
FTP_USER = "coco"
FTP_PASS = "coco"
# create>> dd if=/dev/zero of=output.file bs=1024 count=1024
UPLOAD_FILE = File.new("./output.file")
def upload_file
file_time = Time.now.strftime("%Y%m%d%H%M%S%L")
file_name = "file_#{file_time}-#{Thread.current.object_id}-.xxx"
require_relative './block'
class Blockchain
attr_reader :blocks
def initialize
genesis = Block.new "genesis block", ""
@blocks = [genesis]
end
@gipsh
gipsh / block.rb
Last active March 20, 2018 17:44
blockchain with ruby
require 'digest'
class Block
attr_accessor :hash, :prev_hash, :data, :time
def initialize(data, prev_hash)
@data = data
@prev_hash = prev_hash
@time = Time.now.getutc.to_i
@hash = gen_hash @data,@prev_hash,@time