This file contains 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( | |
"net/http" | |
) | |
func GetCountry(r *http.Request) string { | |
return r.Header.Get("CF-IPCountry") | |
} |
This file contains 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 ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
currentTime := time.Now() | |
fmt.Println("Current Time in String: ", currentTime.String()) |
This file contains 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 ( | |
"fmt" | |
) | |
type Student struct { | |
FirstName string | |
LastName string | |
} |
This file contains 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
const puppeteer = require('puppeteer'); | |
const fs = require('fs'); | |
async function run () { | |
const browser = await puppeteer.launch({ | |
defaultViewport: {width: 1920, height: 1080} | |
}); | |
const page = await browser.newPage(); | |
await page.goto('https://www.google.com/search?q=bitcoin'); | |
await sleep(3000); |
This file contains 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 ( | |
"fmt" | |
"log" | |
"sync" | |
"time" | |
"reflect" | |
"net/http" | |
"encoding/json" |
This file contains 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 sys | |
from PIL import Image | |
def compare_pixels(png1, png2): | |
pixels1 = list(png1.getdata()) | |
pixels2 = list(png2.getdata()) | |
if len(pixels1) != len(pixels2): | |
return -1 # different pixel count | |
match = 0 |
This file contains 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 sys | |
#import time | |
import numpy | |
from PIL import Image | |
def find_image(png_big, png_small): | |
arr_big = numpy.array(png_big) | |
arr_small = numpy.array(png_small) | |
if len(arr_big) < len(arr_small): | |
return [-2,-2] # unable to search a bigger picture in a smaller picture |
This file contains 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 sys | |
import numpy as np | |
from PIL import Image | |
def verify(haystack_start_y, haystack_start_x, arr_haystack, arr_needle): | |
y = haystack_start_y | |
x = haystack_start_x | |
searched = 0 | |
identical = 0 | |
for b in range(0, len(arr_needle)): |
This file contains 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
const puppeteer = require('puppeteer'); | |
const fs = require('fs'); | |
function sleep(ms) { | |
return new Promise((resolve) => { | |
setTimeout(resolve, ms); | |
}); | |
} | |
const get_html = async() => { |
This file contains 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
require 'mysql2' | |
def my_db | |
return Mysql2::Client.new( | |
:host => '127.0.0.1', | |
:username => 'root', | |
:password => 'password', | |
:encoding => 'utf8mb4', | |
:database => 'medium_story', | |
:ssl_mode => 'disabled', |
OlderNewer