cd /usr/share/jenkins
sudo service jenkins stop
sudo mv jenkins.war jenkins.war.old
sudo wget https://updates.jenkins-ci.org/latest/jenkins.war
sudo service jenkins start
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
pub fn cast_to_parts<T>(content: &T) -> &[u8] { | |
let ptr = content as *const T as *const u8; | |
let len = mem::size_of::<T>(); | |
unsafe { std::slice::from_raw_parts(ptr, len) } | |
} | |
pub fn cast_to<T>(value: &[u8]) -> &T { | |
let ptr = value.as_ptr() as *const T; | |
unsafe { &*ptr } | |
} |
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
// Brandon Azad (@_bazad) | |
#include <assert.h> | |
#include <errno.h> | |
#include <mach/mach.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> |
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
// exporting from a bs58 private key to an Uint8Array | |
// == from phantom private key to solana cli id.json key file | |
// npm install bs58 @solana/web3.js | |
const web3 = require("@solana/web3.js"); | |
const bs58 = require('bs58'); | |
let secretKey = bs58.decode("[base58 private key here]"); | |
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`); | |
// exporting back from Uint8Array to bs58 private key |
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
> It's strongly desired by some users to have a network-controlled best effort timestamp associated with the production time of each block. One such example is https://en.bitcoin.it/wiki/Block_timestamp | |
> | |
> Some important properties of this timestamp are: | |
> | |
> 1. Drift of no worse than a couple hours from the actual block production time | |
> 2. Replaying the ledger at a later time results in the same block production time | |
> 3. The block production time is not controlled by a single centralized oracle, but ideally is a function that uses inputs from all validators | |
> | |
> A rough proposal would be to require validators to submit their current UTC time every N minutes. A median time is then constructed from the latest submission and block times are then computed as `last_median_time + slot_offset * 400ms` until the next median time is constructed. | |
> |
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
fn serialize(value: &[i32]) -> &[u8] { | |
let len = value.len() * 4; | |
unsafe { std::slice::from_raw_parts(value.as_ptr().cast(), len) } | |
} | |
fn deserialize(bytes: &[u8]) -> Vec<i32> { | |
assert!(bytes.len() % 4 == 0); | |
let mut vec = Vec::<i32>::with_capacity(bytes.len() / 4); | |
unsafe { | |
std::ptr::copy_nonoverlapping(bytes.as_ptr(), vec.as_mut_ptr().cast(), bytes.len()); |
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
# Set Envs | |
export ANCHOR_WALLET="/Users/YOUR_USER/.config/solana/id.json" | |
# export ANCHOR_PROVIDER_URL="http://127.0.0.1:8899" | |
export ANCHOR_PROVIDER_URL="https://api.devnet.solana.com" | |
# airdrop wallet | |
solana airdrop 2 $(solana-keygen pubkey $ANCHOR_WALLET) --url https://api.devnet.solana.com && solana airdrop 2 $(solana-keygen pubkey $ANCHOR_WALLET) --url https://api.devnet.solana.com | |
# deploy |
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
# Get S3 metadata | |
aws s3 ls s3://YOUR_S3_BUCKET --recursive --summarize --human-readable | |
# Group files by extension | |
aws s3 ls s3://YOUR_S3_BUCKET --recursive \ | |
| grep -v -E '^.+/$' \ | |
| awk '{na=split($NF, a, "."); tot[a[na]] += $3; num[a[na]]++;} END {for (e in tot) printf "%15d %6d %s\n", tot[e], num[e], e};' |
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
#!/bin/bash | |
sudo yum install gcc -y | |
sudo yum install openssl-devel -y | |
sudo yum install zlib-devel -y | |
sudo yum install mlocate -y | |
sudo yum install autoconf -y | |
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz | |
tar zxvf openssh-8.2p1.tar.gz | |
cd openssh-8.2p1 && ./configure && make && sudo make install |
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
SELECT table_schema AS "Data Base Name", sum( data_length + index_length ) / 1024 / 1024 AS "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema; |
NewerOlder