Skip to content

Instantly share code, notes, and snippets.

from awsglue.dynamicframe import DynamicFrame
from pyspark.sql.functions import to_timestamp, col
dataFrame = datasource0.toDF().withColumn("created_at", to_timestamp(col("created_at"),"yyyy-mm-dd HH:mm:ss"))
editedData = DynamicFrame.fromDF(dataFrame, glueContext, "editedData")
applymapping1 = ApplyMapping.apply(frame = editedData, mappings =
@sharkyak
sharkyak / gist:4b83537a9579e7ce60bd54069c380852
Created April 21, 2021 15:06
github actions environment
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
echo "$GITHUB_CONTEXT"
~/.ssh/config
Host gitolite-as-alice
HostName git.company.com
User git
IdentityFile /home/whoever/.ssh/id_rsa.alice
IdentitiesOnly yes
Host gitolite-as-bob
HostName git.company.com
@sharkyak
sharkyak / gist:934100d229232864fd0d5d715a1acd38
Created December 17, 2020 12:44
elasticsearch count records with conditions and range
GET /filebeat-*/_search
{
"query": {
"bool": {
"must": [
{
"term": {
"host.hostname": {
"value": "mail"
}
@sharkyak
sharkyak / netstat
Created July 24, 2020 16:54
netstat
# netstat -tpln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 647/sshd
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 22183/postgres
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1099/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 7779/apache2
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7779/apache2
@sharkyak
sharkyak / ubuntu.sh
Last active August 19, 2020 18:24
ohmyzsh
apt update
apt upgrade
reboot
apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
@sharkyak
sharkyak / console.js
Created April 7, 2020 05:15
polar express polexp parcel summary price
[...$$('.pricepop')].reduce((prev, curr) => prev + parseFloat(curr.innerText.slice(0, -2)), 0)
@sharkyak
sharkyak / main.js
Created March 10, 2020 17:27
<br> \n in react
If you are adding multiple lines of text with \n to a div, add the following to the css for the div in question:
div {
white-space: pre-wrap;
}
@sharkyak
sharkyak / main.js
Created January 25, 2019 15:23
send message to telegram
function sendMessage() {
const MSG = encodeURI('test message')
const TOKEN = 'xxx'
const CHAT = '-xxx'
fetch(`https://api.telegram.org/bot${TOKEN}/sendMessage?chat_id=${CHAT}&parse_mode=html&text=${MSG}`, {
method: 'POST',
headers: new Headers({'Content-Type': 'application/json'})
})
@sharkyak
sharkyak / gist:f6cc56e8d1bc42dadc781783bd52b26b
Created April 6, 2018 04:41
wordpress права на файлы
Права на файлы и директории в WordPress
600 (-rw-------) wp-config.php
644 (-rw-r--r--) Файлы
755 (-rwxr-xr-x) Директории
Или альтернативный вариант
660 (-rw-rw----) wp-config.php
664 (-rw-rw-r--) Файлы